import React, { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { async_getwatch } from '../store/crmsSlice'
import '../App.css'
export default function FangWen() {

    //获取数据
    let dispatch = useDispatch()
    useEffect(() => {
        dispatch(async_getwatch())
    }, [])
    let obj = useSelector(state => state.crms1)
    //console.log(obj);

    return (
        <div style={{ padding: '0 10px' }}>
            <div>最近访问</div>
            <div className='fangwenbox'>
                {
                    obj.watchlist.map(item => {
                        return <div style={{ width: 100 }} key={item.id}>
                            <div style={{margin:'10px 0'}}>
                                {/* 图片 */}
                                <img src={item.img} alt="" width={50} height={50} className='fangimg' />
                            </div>
                            <div>
                                {/* 文字 */}
                                <p>{item.lanmu}</p>
                            </div>
                        </div>
                    })
                }
            </div>
        </div>
    )
}
